@script RequireComponent(MeshFilter)
@script RequireComponent(MeshRenderer)

private var mesh:Mesh;

function Start(){

	//从左下到右上.
	var verts:Vector3[] = [
		Vector3(0,0,0),
		Vector3(1,0,0),
		Vector3(1,1,0)
	];
	var verts2:Vector3[]=[
		Vector3(1,0,0),
		Vector3(1,1,0),
		Vector3(0,1,0)
	];
	var indices:int[] = [
		0,2,1
	];
	var indices2:int[]=[
		0,2,1
	];
	//纹理坐标从 左下到右上.
	var uv1:Vector2[] = [
		Vector2(0,0),
		Vector2(1,0),
		Vector2(1,1)
	];
	var uv2:Vector2[]=[
		Vector2(1,0),
		Vector2(1,1),
		Vector2(0,1)
	];
	mesh = new Mesh();
	mesh.vertices = verts;
	mesh.triangles = indices;
	mesh.subMeshCount = 2;
	mesh.SetTriangles(indices2,1);
	mesh.uv = uv1;
	mesh.RecalculateNormals();
	

	GetComponent(MeshFilter).mesh = mesh;
}
function Update () {
	
}